﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Krile.Forms.Dialogs.Popup
{
    public partial class ConfigCompatible : Form
    {
        KeyValuePair<Subsystem.CompatibilityControl.CompatibilityDescriptLevel, string>[] items;
        public ConfigCompatible(KeyValuePair<Subsystem.CompatibilityControl.CompatibilityDescriptLevel, string>[] ary)
        {
            InitializeComponent();
            items = ary;
        }

        private void ConfigCompatible_Load(object sender, EventArgs e)
        {
            foreach (var i in items.Reverse<KeyValuePair<Subsystem.CompatibilityControl.CompatibilityDescriptLevel, string>>())
            {
                switch (i.Key)
                {
                    case Krile.Subsystem.CompatibilityControl.CompatibilityDescriptLevel.Incompatible:
                        listPanel.Controls.Add(new ConfigCompatibleElements.CCItem(Krile.Forms.Dialogs.Popup.ConfigCompatibleElements.CCItem.NotificationLevels.Incompatible, i.Value) { Dock = DockStyle.Top });
                        break;
                    case Krile.Subsystem.CompatibilityControl.CompatibilityDescriptLevel.Warning:
                        listPanel.Controls.Add(new ConfigCompatibleElements.CCItem(Krile.Forms.Dialogs.Popup.ConfigCompatibleElements.CCItem.NotificationLevels.Warning, i.Value) { Dock = DockStyle.Top });
                        break;
                    case Krile.Subsystem.CompatibilityControl.CompatibilityDescriptLevel.Notify:
                        listPanel.Controls.Add(new ConfigCompatibleElements.CCItem(Krile.Forms.Dialogs.Popup.ConfigCompatibleElements.CCItem.NotificationLevels.Notice, i.Value) { Dock = DockStyle.Top });
                        break;
                }
            }
        }

        private void ConfigCompatible_Shown(object sender, EventArgs e)
        {
            listPanel.AutoScrollPosition = new Point(0, 0);
        }


    }
}
